/*******************************************************************************
*  file    : backupserver.hpp
*  created : 22.07.2013
*  author  : 
*******************************************************************************/

#ifndef BACKUPSERVER_HPP
#define BACKUPSERVER_HPP

#include <QObject>
#include <QLocalSocket>

class QLocalServer;
class QTimer;

class BackupServer : public QObject
{
    Q_OBJECT
public:
    explicit BackupServer(QObject *parent = 0);
    ~BackupServer();
public:
    bool parseCmdArgs(const QStringList& args);
public slots:
    void start();
protected slots:
    void newLocalSocketConnection();
private slots:
    void socketStateChanged(QLocalSocket::LocalSocketState socketState);
    void connectTimeout();
private:
    void tryConnect();
private:
    QLocalServer* server_;
    QLocalSocket* socket_;
    QTimer*       sock_timer_;
};

#endif // BACKUPSERVER_HPP
